package com.xjscrm.console.web.sys;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.xjscrm.console.param.BaseDto;
import com.xjscrm.console.param.sysconfig.AppFuctionConfigDto;
import com.xjscrm.console.param.sysconfig.SysBrandConfigDto;
import com.xjscrm.console.service.customer.sys.SysConfigService;
import com.xjscrm.console.vo.sysconfig.AppFuctionConfigVo;
import com.xjscrm.console.vo.sysconfig.SysBrandConfigVo;
import com.xjscrm.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuqi
 * @date 2021年09月11日 20:15
 */
@Api(value = "系统设置", tags = "系统设置")
@ApiSort(30)
@RestController
public class SysConfigController extends BaseController {

    @Autowired
    private SysConfigService sysConfigService;

    @ApiOperation(value = "查询系统品牌设置信息", notes = "查询系统品牌设置信息", response = SysBrandConfigVo.class)
    @PostMapping("/sysConfig/findSysBrandConfig")
    @ApiOperationSupport(order = 1)
    public Object findSysBrandConfig(@RequestBody BaseDto baseDto){
        return sysConfigService.findSysBrandConfig(baseDto.getMerId());
    }

    @ApiOperation(value = "保存系统品牌设置信息", notes = "保存系统品牌设置信息")
    @ApiOperationSupport(order = 2)
    @PostMapping("/sysConfig/updateSysBrandConfig")
    public Object updateSysBrandConfig(@RequestBody SysBrandConfigDto sysBrandConfigDto){
        sysConfigService.updateSysBrandConfig(sysBrandConfigDto);
        return true;
    }

    @ApiOperation(value = "查询App功能设置信息", notes = "查询App功能设置信息", response = AppFuctionConfigVo.class)
    @PostMapping("/sysConfig/findAppFuctionConfig")
    @ApiOperationSupport(order = 1)
    public Object findAppFuctionConfig(@RequestBody BaseDto baseDto){
        return sysConfigService.findAppFuctionConfig(baseDto.getMerId());
    }

    @ApiOperation(value = "保存App功能设置信息", notes = "保存App功能设置信息")
    @ApiOperationSupport(order = 2)
    @PostMapping("/sysConfig/updateAppFuctionConfig")
    public Object updateAppFuctionConfig(@RequestBody AppFuctionConfigDto appFuctionConfigDto){
        sysConfigService.updateAppFuctionConfig(appFuctionConfigDto);
        return true;
    }
}
